<?php
	if(isset($_SESSION["client"]) && !isset($client))
	{
		$client = getLoginData();
	}
	$index = 1;
?>
<?php foreach($products as $key => $product): ?>
	<div class="product">
		<a href="<?php echo $product["url"]; ?>" title="<?php echo $product["name"]; ?>" class="productImage">
			<img alt="" src="<?php echo scripts_url().$product["images"][0]["thumb_name"]?>"/>
		</a>
		<div class="productDetails">
			<a href="<?php echo $product["url"]; ?>" title="<?php echo $product["name"]; ?>"><?php echo $product["name"]; ?></a>
			<div class="productPrice row"><?php echo strtolower(translate("price")); ?>: <?php echo $product["price"]; ?></div>
			<hr />
			<?php if(!isset($show) || $show == "discount"):?>
				<div class="discount">
					<?php if(isset($product["discount"]) && $product["discount"]["discount_percent"] > 0 || $product["discount"]["discount_static"] > 0): ?>
						
						<?php
							if($product["discount"]["discount_percent"] > 0)
							{
								echo "-".$product["discount"]["discount_percent"]."%";
							}
							elseif($product["discount"]["discount_static"] > 0)
							{
								echo "-".$product["discount"]["discount_static"]."".$settings["currency"];
							}
						?>
						<sup><?php echo translate("discount"); ?></sup>
					<?php endif; ?>
				</div>
			<?php elseif($show == "views"):?>
				<div class="views"><?php echo $product["view_count"]; ?> <?php echo ($product["view_count"] == 1 ? translate("vizualizare") : translate("vizualizari")); ?></div>
			<?php endif;?>
		</div>
		<?php
			if($index % $settings["number_of_products"]  != 0)
			{
				echo '<div class="spacer"></div>';
			}
		?>
	</div>
	<?php
	if($index % $settings["number_of_products"]  == 0)
	{
		echo "<div class='clearfix'></div>";
	}
	$index++;
endforeach; ?>